﻿using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using NColony.Syndication.Receiver.Contracts;

namespace NColony.Client.Wpf.ViewModels.Contracts
{
    /// <summary>
    /// Contract class for <see cref="IMainWindowViewModel"/>.
    /// </summary>
    [ContractClassFor(typeof(IMainWindowViewModel))]
    public abstract class IMainWindowViewModelContract : IMainWindowViewModel
    {
        /// <summary>
        /// Gets or sets the feed reader.
        /// </summary>
        /// <value>The feed reader.</value>
        [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value", Justification = "Contracts will never use the value")]
        public ISyndicationReader<ISyndicationFeed> FeedReader
        {
            get
            {
                Contract.Ensures(Contract.Result<ISyndicationReader<ISyndicationFeed>>() != null, "Return value will never be null");

                return default(ISyndicationReader<ISyndicationFeed>);
            }

            set
            {
                Contract.Requires(value != null, "value cannot be null");
            }
        }

        /// <summary>
        /// Loads the feed reader.
        /// </summary>
        /// <param name="feedAddress">The feed address.</param>
        public void LoadFeedReader(string feedAddress)
        {
            Contract.Requires(!String.IsNullOrEmpty(feedAddress), "feedAddress cannot be null or empty");
        }

#pragma warning disable 0067
        /// <summary>
        /// Occurs when a property value is changing.
        /// </summary>
        public event PropertyChangingEventHandler PropertyChanging;

        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;
#pragma warning restore 0067
    }
}
